﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Hotnet.Entity.ViewListVideo>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	视频组管理
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

	<div>
		<div style=" font-size:x-large">视频组管理</div>
		<div style=" margin:15px 0px 3px 39px;">
			<span style="color:Red">
				所在位置:
			</span>
			<a href="/AdminVideoGroup/Index/?categoryID=<%=ViewData["CategoryID"] %>" style=" text-decoration:none;">
				<%=ViewData["CategoryName"] %>
			</a>
			->
			视频组管理
		</div>
	</div>


	<div style="border:1px solid gray; padding:5px; margin-left:39px;">
		<div style="margin:3px;">
			<a style=" float:right;" href="/AdminVideoGroup/Create/?CategoryID=<%=ViewData["CategoryID"] %>">创建视频组</a>
			<a href="/AdminVideo/Index?categoryID=<%=ViewData["CategoryID"] %>">单视频管理</a>
			<a href="javascript:void(0)" style="color:Red;">视频组管理</a>
		</div>
		<div class="divDot"></div>
	<%Html.BeginForm("Index","AdminVideoGroup", new { categoryid = ViewData["CategoryID"] }); %>
		<div style=" text-align:center;">
				<span>
					视频组名称:<%=Html.TextBox("VideoName", null, new { style="width:80px;" })%>
				</span>
				<span>
					来源网站:<%=Html.DropDownList("SourceFromID", Hotnet.Web.Controllers.Admin.AdminVideoController.VideoNetList)%>
				</span>
				<span>
					所属列表:<%=Html.DropDownList("DefineType", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumDefineType>().Reverse())%>
				</span>
				<span>
					排序:<%=Html.DropDownList("OrderType", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumOrder>())%>
				</span>
				<span>
					状态:<%=Html.DropDownList("IsPublished", ConvertEnumToSelectList.ComposeSelectListFromEnum<EnumPublishState>().Reverse())%>
				</span>
				<input type="submit" value="搜索" />
		</div>
	<%Html.EndForm(); %>
	</div>
	<ul class="videolist">
		<% foreach (var item in Model)
	 { %>
		<li>
			<div style=" padding:5px; float:left;" class="imageDiv">
				<a href="/AdminVideoGroup/GroupVideoList/<%=Html.Encode(item.VideoID) %>"  >
					<img src="<%= Html.Encode(item.CoverImagePath) %>" alt="视频封面"/>
				</a>
			</div>
			<span>
				名称:<span style="color:Red;"><%= Html.Encode(item.Name) %></span>
			</span>
			<div>
				<span>
					来源:<%= Html.Encode(item.SourceFromName) %>
					(<%= Html.Encode(String.Format("{0:g}", item.AddTime)) %>)
				</span>
			</div>
			<div>
				播放:<%= Html.Encode(item.IsCanPlayInner) == "True" ? "内部播放" : "外部播放"%>(<%=Html.Encode(item.ClickCount)%>)
			</div>
			<div>
				列表:
				<span id="spanDeleteList<%=item.VideoID %>">
					<%= Html.Encode(Convert.ToString((EnumDefineType)item.DefineType))%>
				</span>
				<%=(int)item.DefineType != -1 ? "<a id='aDeleteList" + item.VideoID + "' href='javascript:deleteInList(" + item.VideoID + ")'>撤出列表</a>" : ""%>
			</div>
			<div>
				<a href="/AdminVideoGroup/Edit/<%=Html.Encode(item.VideoID) %>">编辑</a>
				<a href="javascript:deleteGroup(<%=item.VideoID %>)">删除</a>
				<a href="/AdminVideoGroup/GroupVideoList/<%=Html.Encode(item.VideoID) %>">进入该组</a>
				<a href="javascript:setPublished(<%=item.VideoID %>);" id="setP<%=item.VideoID %>" <%=(item.IsPublished==1?"style='display:none;'":"") %>>发布</a>
				<a href="javascript:unSetPublished(<%=item.VideoID %>);" id="unsetP<%=item.VideoID %>" <%=(item.IsPublished==1?"":"style='display:none;'") %> >取消发布</a>
			</div>
		</li>

		<% } %>
	</ul>
	<div>
		<%Html.RenderPartial("PaginateHelper", ViewData["PaginateHelper"] as PaginateHelper); %>
	</div>

</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">

	<script type="text/javascript">
		$(document).ready(
			function() {
				
				$("#DefineType option[value='-1']").html("全部");
			}
		);

			function setPublished(videoID) {

				$.ajax(
			{
				url: "/AdminVideo/SetPublished/",
				data: "videoID=" + videoID,
				type: "post",
				success: function() {
					document.getElementById("setP" + videoID).style.cssText = "display:none";
					document.getElementById("unsetP" + videoID).style.cssText = "";
				}
			}
			);
			}
			function unSetPublished(videoID) {

				$.ajax(
			{
				url: "/AdminVideo/UnSetPublished/",
				data: "videoID=" + videoID,
				type: "post",
				success: function() {
					document.getElementById("setP" + videoID).style.cssText = "";
					document.getElementById("unsetP" + videoID).style.cssText = "display:none";
				}
			}
			);
			}

			function deleteGroup(groupID) {

				if (!confirm("确认删除此组么,将删除此组下面的所有视频?"))
					return;
				$.post("/AdminVideoGroup/Delete/" + groupID,
				function(data) {
				if (data.toUpperCase() == "TRUE")
					alert("删除成功！");
					window.location.href = window.location.href;
				});
			}
			function deleteInList(groupID) {
				$.post("/AdminVideoGroup/DeleteInList/" + groupID,
				function(data) {
					if (data.toUpperCase() != "TRUE") {
						alert("撤出失败！");
						return;
					}
					$("#spanDeleteList" + groupID).html("None");
					$("#aDeleteList" + groupID).remove();
				});
			}
	
	</script>
	
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="StyleContent" runat="server">
	
		<style type="text/css">
		.videolist
		{
			list-style-image:none;
			list-style-position:outside;
			list-style-type:none;
			
		}
		.videolist img
		{
			 width:110px;
			 height:90px;
			 border:none;
			
		}
		.videolist li
		{
			 clear:left;
			 border:1px gray solid;
			 padding-bottom:5px;
			 margin-bottom:1px;
		}
		
		.divDot
		{
			border-bottom:1px solid gray; 
			border-bottom-style:dotted;
			margin:8px 0px 8px 0px;
		}
		
		.imageDiv{}
		.imageDiv a:hover
		{
			background-color:White;
		}
		
		.divDot
		{
			border-bottom:1px solid gray; 
			border-bottom-style:dotted;
			margin:8px 0px 8px 0px;
		}
		
	</style>

</asp:Content>
